import React from "react";
import ReactDom from 'react-dom';
import Brother from "./brother.jsx";
import Sister from "./Sister"
/**
 * react 测试 兄弟组件之间通信，需要父组件作为中转
 *  */
export default class Parent extends React.Component{
    constructor(props){
        super(props);
        this.state={
            data:""
        }
    }
    passData(event){
        console.log(1);
        this.setState({
            data:event.target.value
        });
       
    }
 
    render(){
        return (
            <div>
                <p>{this.state.data}</p>
                <Brother handleData={this.passData.bind(this)} />
                <Sister data={this.state.data} />
            </div>
        )
    }
}
